package kr.or.kead.ui.list.model;

import kr.or.kead.domain.Depart;
import kr.or.kead.service.DaoHandicap;
import kr.or.kead.service.Daodepart;

public class StdCustomTableModel extends AbsCustomTableModel {
	private DaoHandicap daoHandi;
	private Daodepart daoDepart;
	
	public StdCustomTableModel() {
		sql = "Select idx '번호', stdname '이름', juminnum '주민번호' ,"
				+ "startdate '입소일자', enddate '퇴소일자', mobile '휴대폰',"
				+ "tel '집전화', stdaddr '주소', roomnum '통학/기숙', "
				+ "stdtype '장애 타입', grade '장애 등급', email '이메일',"
				+ "departcode '학과' from infostudent";
		getResultSet();
		daoHandi = new DaoHandicap();
		daoDepart = new Daodepart();
	}

	@Override
	public Object getValueAt(int row, int col) {
		Object[] std = arData.get(row);
		switch(col){
		case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:
			return std[col];
		case 8: return (int)std[col]==500?"통학":std[col];
		case 9: return daoHandi.selectTableById((int)std[col]);
		case 10: return std[col]+"등급";
		case 11: return std[col];
		case 12: Depart depart = (Depart) daoDepart.selectTableById((int)std[col]);
				return depart.getName();
		}
		return "";
	}

}
